﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class BackButton : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        if(GlobalSettings.Instance.isStarted  == true || GlobalSettings.Instance.sheetEnd == false)
        {
            gameObject.SetActive(false);
        }
    }

    // Update is called once per frame
    void Update()
    {
        
    }

    public void backToMain()
    {
        GlobalSettings.Instance.isStarted = false;//是否开始游戏
        GlobalSettings.Instance.k1Pressed = false; //按钮是否按下
        GlobalSettings.Instance.k2Pressed = false;
        GlobalSettings.Instance.k3Pressed = false;
        GlobalSettings.Instance.k4Pressed = false;
        GlobalSettings.Instance.k1InZone = false; //note是否进入判定区
        GlobalSettings.Instance.k2InZone = false;
        GlobalSettings.Instance.k3InZone = false;
        GlobalSettings.Instance.k4InZone = false;
        GlobalSettings.Instance.isPaused = false;//是否暂停
        GlobalSettings.Instance.sheetEnd = false;//谱面是否读到最后一行的end
        Time.timeScale = 1;
        SceneManager.LoadScene(0);     
    }
}
